package com.chinasoft.ssm.mapper;

import com.chinasoft.ssm.pojo.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AccountMapper {

    @Insert("insert into tbl_account(name,money)values(#{name},#{money})")
    Integer save(Account account);

    @Delete("delete from tbl_account where id = #{id} ")
    Integer delete(Integer id);

    @Update("update tbl_account set name = #{name} , money = #{money} where id = #{id} ")
    Integer update(Account account);

    @Select("select * from tbl_account")
    List<Account> findAll();

    @Select("select * from tbl_account where id = #{id} ")
    Account findById(Integer id);

    @Select("select * from tbl_account where name = #{name} ")
    Account findByName(String name);
}
